package com.dsj.gxrd.modules.book.domain.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ruoyi.common.security.utils.SecurityUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 【请填写功能名称】对象 rd_file
 * 
 * @author ruoyi
 * @date 2023-09-11
 */
@Data
@TableName("rd_file")
@ApiModel(description = "上传文件")
public class RdFile
{
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("文件id")
    @TableId(type= IdType.ASSIGN_ID)
    private Long rdFileId;

    @ApiModelProperty("原始文件名称")
    private String fileName;

    @ApiModelProperty("url")
    private String url;

    @ApiModelProperty("后缀名(jpg,png,mp4)")
    private String suffixName;

    @ApiModelProperty("文件具体关联业务的类型")
    private Integer relationType;

    @ApiModelProperty("关联具体的业务id")
    private Long relationId;

    @TableLogic
    @ApiModelProperty("删除标志0显示 2删除")
    private Integer delFlag;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("修改时间")
    private LocalDateTime updateTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty("修改者")
    private Long updateBy;

    public RdFile(){

    }

    public RdFile(String fileName,String url,Long relationId,Integer relationType,Integer delFlag){
        this.fileName=fileName;
        this.url=url;
        this.relationId=relationId;
        this.relationType=relationType;
        this.delFlag=delFlag;
        this.updateBy=SecurityUtils.getLoginUser().getUserid();
        this.updateTime=LocalDateTime.now();
    }

}
